<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('permissions', function (Blueprint $table) {
            $table->string('type', 20)->default('button')->after('code')->comment('权限类型：menu-菜单, button-按钮, data-数据');
            $table->string('action', 50)->nullable()->after('type')->comment('操作类型：view-查看, create-新增, update-编辑, delete-删除, export-导出等');
            $table->string('resource', 100)->nullable()->after('action')->comment('资源标识：如 users, roles 等');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('permissions', function (Blueprint $table) {
            $table->dropColumn(['type', 'action', 'resource']);
        });
    }
};

